// Home页面核心样式文件
// 从Home.vue提取的985行样式代码
// 分模块组织，提升可维护性

// 导入CSS变量系统
@import '@/styles/variables.scss';

// ===============================
// 1. 全局容器和布局样式
// ===============================

/* 全局容器 - 清新学院风渐变背景 */
.portal-container {
  min-height: 100vh;
  background: linear-gradient(135deg, #F0F9FF 0%, #DBEAFE 20%, #BFDBFE 100%);
  position: relative;

  /* 添加微妙的背景图案 */
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
      radial-gradient(circle at 20% 80%, rgba(59, 130, 246, 0.03) 0%, transparent 50%),
      radial-gradient(circle at 80% 20%, rgba(16, 185, 129, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 1;
  }

  /* 确保内容在背景之上 */
  > * {
    position: relative;
    z-index: 2;
  }
}

/* 三区布局主体 */
.portal-main {
  display: grid;
  grid-template-columns: 300px 1fr 320px;
  gap: var(--spacing-xl);
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-xl);
}

// ===============================
// 2. 智能工作台样式
// ===============================

/* 中间智能工作台 - 革命性重构样式 */
.intelligent-workspace {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevated);
  border: 1px solid rgba(59, 130, 246, 0.1);
  padding: var(--spacing-xl);
  height: fit-content;
  transition: all var(--duration-base) var(--ease-in-out);

  &:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(30, 58, 138, 0.12);
  }
}

/* 优先通知工作台区域 - 革命性分级颜色系统 */
.priority-workspace-section {
  margin-bottom: var(--spacing-xl);
  border-radius: var(--radius-xl);
  padding: var(--spacing-xl);
  background: linear-gradient(135deg, rgba(240, 249, 255, 0.6) 0%, rgba(255, 255, 255, 0.9) 100%);
  border: 1px solid rgba(59, 130, 246, 0.15);
}

.workspace-priority-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid rgba(59, 130, 246, 0.1);

  h4 {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: #1E3A8A;
  }
}

.priority-notification-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

// ===============================
// 3. 分级通知卡片样式
// ===============================

/* 分级通知卡片 - 红橙蓝分级设计 */
.priority-notification-card {
  background: var(--color-bg-base);
  border-radius: var(--radius-lg);
  padding: calc(var(--spacing-lg) + 2px);
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-in-out);
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;

  /* Level 1 紧急通知 - 红色系 */
  &.level-1-emergency {
    background: linear-gradient(135deg, #ffebee 0%, #fef2f2 100%);
    border-color: #f87171;
    box-shadow: 0 4px 15px rgba(248, 113, 113, 0.15);

    &:hover {
      border-color: #dc2626;
      transform: translateY(-2px);
      box-shadow: 0 8px 25px rgba(220, 38, 38, 0.2);
    }

    &::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 4px;
      height: 100%;
      background: linear-gradient(180deg, #dc2626 0%, #f87171 100%);
    }
  }

  /* Level 2 重要通知 - 橙色系 */
  &.level-2-important {
    background: linear-gradient(135deg, #fff8e1 0%, #fffbeb 100%);
    border-color: #fbbf24;
    box-shadow: 0 4px 15px rgba(251, 191, 36, 0.15);

    &:hover {
      border-color: #d97706;
      transform: translateY(-2px);
      box-shadow: 0 8px 25px rgba(217, 119, 6, 0.2);
    }

    &::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 4px;
      height: 100%;
      background: linear-gradient(180deg, #d97706 0%, #fbbf24 100%);
    }
  }

  /* Level 3 常规通知 - 蓝色系 */
  &.level-3-regular {
    background: linear-gradient(135deg, #e3f2fd 0%, #f0f9ff 100%);
    border-color: #60a5fa;
    box-shadow: 0 4px 15px rgba(96, 165, 250, 0.15);

    &:hover {
      border-color: #2563eb;
      transform: translateY(-2px);
      box-shadow: 0 8px 25px rgba(37, 99, 235, 0.2);
    }

    &::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 4px;
      height: 100%;
      background: linear-gradient(180deg, #2563eb 0%, #60a5fa 100%);
    }
  }
}

// ===============================
// 4. 通知内容样式
// ===============================

.notification-priority-content {
  position: relative;
  z-index: 2;
}

.notification-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  gap: 12px;
}

.notification-title-priority {
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
  line-height: 1.4;
  flex: 1;
  min-width: 0;
}

.notification-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.mark-read-btn {
  min-width: 60px;
}

// ===============================
// 5. 校园资讯区样式
// ===============================

.campus-news {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(59, 130, 246, 0.1);
  min-height: fit-content;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid rgba(59, 130, 246, 0.1);

  h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1e3a8a;
    display: flex;
    align-items: center;
    gap: 8px;
  }
}

.news-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

// 新增：校园服务卡片专用样式（替代原news-card）
.services-card {
  background: linear-gradient(135deg, rgba(240, 249, 255, 0.4) 0%, rgba(255, 255, 255, 0.7) 100%);
  border-radius: 10px;
  padding: 16px;
  border: 1px solid rgba(59, 130, 246, 0.08);

  h4 {
    margin: 0 0 12px 0;
    font-size: 15px;
    font-weight: 600;
    color: #2563eb;
  }
}

// 注意：已移除以下与组件内部样式冲突的类
// - .news-card (由CampusNewsPanel组件自行管理)
// - .news-list (由CampusNewsPanel组件自行管理)
// - .news-item (由CampusNewsPanel组件自行管理)
// - .news-image (由CampusNewsPanel组件自行管理)
// - .news-info (由CampusNewsPanel组件自行管理)
// - .news-title (由CampusNewsPanel组件自行管理)
// - .news-time (由CampusNewsPanel组件自行管理)
// 这些样式现在完全由相应的组件封装管理

// ===============================
// 6. 系统公告样式
// ===============================

.system-announcements-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.system-announcement-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 18px;
  border-radius: 12px;
  border: 1px solid rgba(59, 130, 246, 0.1);
  margin-bottom: 12px;
  background: linear-gradient(135deg, rgba(240, 249, 255, 0.6) 0%, rgba(255, 255, 255, 0.9) 100%);
  min-height: 130px;
  position: relative;

  &:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(16, 185, 129, 0.08) 100%);
    transform: translateX(4px);
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.15);
  }

  .announcement-title {
    font-weight: 600;
    font-size: 15px;
    line-height: 1.4;
    margin-bottom: 8px;
    color: #1a202c;
  }

  .announcement-content-preview {
    background: rgba(249, 250, 251, 0.8);
    border-left: 3px solid #3b82f6;
    font-size: 13px;
    line-height: 1.6;
    -webkit-line-clamp: 4;
  }
}

.announcement-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.announcement-time {
  font-size: 11px;
  color: #999;
}

.announcement-summary,
.announcement-content-preview {
  font-size: 13px;
  color: #666;
  line-height: 1.6;
  margin-top: 8px;
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 6px;
  border-left: 3px solid #e9ecef;
  white-space: pre-line;
  word-wrap: break-word;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

.no-announcements {
  text-align: center;
  padding: 20px;
  color: #999;
}

// ===============================
// 7. 服务信息样式
// ===============================

.service-info-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.service-info-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: white;
  border-radius: 8px;
  transition: all 0.3s ease;

  &:hover {
    background: rgba(59, 130, 246, 0.05);
    transform: translateX(4px);
  }
}

.info-content {
  flex: 1;
}

.info-title {
  font-size: 14px;
  font-weight: 500;
  color: #1f2937;
  margin-bottom: 2px;
}

.info-details {
  font-size: 12px;
  color: #6b7280;
}

// ===============================
// 8. 响应式设计
// ===============================

@media (max-width: 1200px) {
  .portal-main {
    grid-template-columns: 250px 1fr 280px;
    gap: 20px;
    padding: 0 20px;
  }
}

@media (max-width: 992px) {
  .portal-main {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .campus-news {
    max-height: none;
  }
}

@media (max-width: 768px) {
  .portal-main {
    padding: 0 16px;
  }

  .intelligent-workspace,
  .campus-news {
    padding: 16px;
  }

  .priority-workspace-section {
    padding: 16px;
  }

  .priority-notification-card {
    padding: 14px;
  }

  // 已移除 .news-item 和 .news-image 的响应式样式
  // 这些现在由 CampusNewsPanel 组件自行管理
}

// ===============================
// 9. 滚动条美化
// ===============================

.campus-news::-webkit-scrollbar {
  width: 6px;
}

.campus-news::-webkit-scrollbar-track {
  background: rgba(59, 130, 246, 0.05);
  border-radius: 3px;
}

.campus-news::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.3);
  border-radius: 3px;

  &:hover {
    background: rgba(59, 130, 246, 0.5);
  }
}

// ===============================
// 10. 动画定义
// ===============================

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.fade-enter-active {
  animation: fadeIn 0.3s ease;
}

.slide-enter-active {
  animation: slideIn 0.3s ease;
}